In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from plotly import graph_objects as go
from plotly import express as px
from plotly.offline import init_notebook_mode, iplot
In [2]:
Games = pd.read_csv("vgsales.csv")
Games.isna().any()
Out[2]:
Rank            False
Name            False
Platform        False
Year             True
Genre           False
Publisher        True
NA_Sales        False
EU_Sales        False
JP_Sales        False
Other_Sales     False
Global_Sales    False
dtype: bool
In [3]:
bool_series = pd.isnull(Games["Year"])
Games[bool_series].count()
Out[3]:
Rank            271
Name            271
Platform        271
Year              0
Genre           271
Publisher       249
NA_Sales        271
EU_Sales        271
JP_Sales        271
Other_Sales     271
Global_Sales    271
dtype: int64
In [4]:
Games[bool_series].head(50)
Out[4]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
179 180 Madden NFL 2004 PS2 NaN Sports Electronic Arts 4.26 0.26 0.01 0.71 5.23
377 378 FIFA Soccer 2004 PS2 NaN Sports Electronic Arts 0.59 2.36 0.04 0.51 3.49
431 432 LEGO Batman: The Videogame Wii NaN Action Warner Bros. Interactive Entertainment 1.86 1.02 0.00 0.29 3.17
470 471 wwe Smackdown vs. Raw 2006 PS2 NaN Fighting NaN 1.57 1.02 0.00 0.41 3.00
607 608 Space Invaders 2600 NaN Shooter Atari 2.36 0.14 0.00 0.03 2.53
624 625 Rock Band X360 NaN Misc Electronic Arts 1.93 0.34 0.00 0.21 2.48
649 650 Frogger's Adventures: Temple of the Frog GBA NaN Adventure Konami Digital Entertainment 2.15 0.18 0.00 0.07 2.39
652 653 LEGO Indiana Jones: The Original Adventures Wii NaN Action LucasArts 1.54 0.63 0.00 0.22 2.39
711 713 Call of Duty 3 Wii NaN Shooter Activision 1.19 0.84 0.00 0.23 2.26
782 784 Rock Band Wii NaN Misc MTV Games 1.35 0.56 0.00 0.20 2.11
1126 1128 Call of Duty: Black Ops PC NaN Shooter Activision 0.58 0.81 0.00 0.24 1.63
1133 1135 Rock Band PS3 NaN Misc Electronic Arts 0.99 0.41 0.00 0.22 1.62
1303 1305 Triple Play 99 PS NaN Sports NaN 0.81 0.55 0.00 0.10 1.46
1433 1435 LEGO Harry Potter: Years 5-7 Wii NaN Action Warner Bros. Interactive Entertainment 0.76 0.47 0.00 0.13 1.36
1498 1500 LEGO Batman: The Videogame PSP NaN Action Warner Bros. Interactive Entertainment 0.57 0.46 0.00 0.28 1.32
1513 1515 Adventure 2600 NaN Adventure Atari 1.21 0.08 0.00 0.01 1.30
1585 1587 Combat 2600 NaN Action Atari 1.17 0.07 0.00 0.01 1.25
1649 1651 NASCAR Thunder 2003 PS2 NaN Racing Unknown 0.60 0.46 0.00 0.16 1.22
1697 1699 Hitman 2: Silent Assassin XB NaN Action Eidos Interactive 0.76 0.38 0.00 0.05 1.19
1837 1839 Rock Band PS2 NaN Misc Electronic Arts 0.71 0.06 0.00 0.35 1.11
1990 1992 Legacy of Kain: Soul Reaver PS NaN Action Eidos Interactive 0.58 0.40 0.00 0.07 1.04
2019 2021 Donkey Kong Land III GB NaN Platform Nintendo 0.68 0.31 0.00 0.04 1.03
2086 2088 LEGO Harry Potter: Years 5-7 X360 NaN Action Warner Bros. Interactive Entertainment 0.51 0.39 0.00 0.09 0.99
2113 2115 Air-Sea Battle 2600 NaN Shooter Atari 0.91 0.06 0.00 0.01 0.98
2114 2116 Suikoden III PS2 NaN Role-Playing Unknown 0.29 0.23 0.38 0.08 0.98
2134 2136 Yakuza 4 PS3 NaN Action Sega 0.15 0.14 0.63 0.05 0.97
2145 2147 LEGO Harry Potter: Years 5-7 PS3 NaN Action Warner Bros. Interactive Entertainment 0.36 0.45 0.00 0.16 0.97
2173 2175 Wheel of Fortune PS2 NaN Misc Unknown 0.47 0.36 0.00 0.12 0.95
2286 2288 Namco Museum XB NaN Misc Unknown 0.77 0.11 0.00 0.04 0.91
2295 2297 Rhythm Heaven Wii NaN Misc Unknown 0.13 0.00 0.77 0.01 0.90
2415 2417 The Lord of the Rings: War in the North PS3 NaN Action Warner Bros. Interactive Entertainment 0.25 0.45 0.01 0.15 0.86
2422 2424 The Lord of the Rings: War in the North X360 NaN Action Warner Bros. Interactive Entertainment 0.52 0.26 0.00 0.08 0.86
2484 2486 Madden NFL 07 PSP NaN Sports Unknown 0.77 0.03 0.00 0.04 0.83
2497 2499 MLB SlugFest 20-03 PS2 NaN Sports Unknown 0.41 0.32 0.00 0.11 0.83
2528 2530 Shaun White Snowboarding X360 NaN Sports Ubisoft 0.48 0.26 0.00 0.08 0.82
2586 2588 PES 2009: Pro Evolution Soccer PSP NaN Sports Konami Digital Entertainment 0.04 0.33 0.26 0.17 0.80
2776 2778 Madden NFL 11 Wii NaN Sports Unknown 0.70 0.00 0.00 0.05 0.74
2786 2788 WarioWare: Twisted! GBA NaN Puzzle Unknown 0.16 0.06 0.50 0.02 0.74
2838 2840 LEGO Harry Potter: Years 5-7 DS NaN Action Warner Bros. Interactive Entertainment 0.35 0.30 0.00 0.07 0.72
2947 2949 Test Drive Unlimited 2 X360 NaN Racing Atari 0.30 0.32 0.00 0.07 0.69
3049 3051 The Chronicles of Narnia: The Lion, The Witch ... GBA NaN Action Disney Interactive Studios 0.48 0.18 0.00 0.01 0.67
3141 3143 Test Drive Unlimited 2 PS3 NaN Racing Atari 0.16 0.35 0.01 0.12 0.64
3194 3196 Monster Hunter 2 PS2 NaN Role-Playing Capcom 0.00 0.00 0.63 0.00 0.63
3217 3219 Advance Wars: Days of Ruin DS NaN Strategy Nintendo 0.44 0.13 0.00 0.06 0.63
3238 3240 Metal Gear Solid 2: Substance XB NaN Action Konami Digital Entertainment 0.38 0.22 0.00 0.03 0.62
3346 3348 The Golden Compass Wii NaN Action Sega 0.26 0.28 0.00 0.07 0.60
3421 3423 Madden NFL 06 X360 NaN Sports Electronic Arts 0.54 0.00 0.01 0.03 0.59
3468 3470 NASCAR: Dirt to Daytona PS2 NaN Racing Unknown 0.28 0.22 0.00 0.07 0.58
3501 3503 Madden NFL 2002 XB NaN Sports Unknown 0.53 0.02 0.00 0.03 0.58
3715 3717 Def Jam: Fight for NY XB NaN Fighting Electronic Arts 0.43 0.10 0.00 0.02 0.54
In [5]:
bool_series = pd.isnull(Games["Publisher"])
Games[bool_series].count()
Out[5]:
Rank            58
Name            58
Platform        58
Year            36
Genre           58
Publisher        0
NA_Sales        58
EU_Sales        58
JP_Sales        58
Other_Sales     58
Global_Sales    58
dtype: int64
In [6]:
Games[bool_series]
Out[6]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
470 471 wwe Smackdown vs. Raw 2006 PS2 NaN Fighting NaN 1.57 1.02 0.00 0.41 3.00
1303 1305 Triple Play 99 PS NaN Sports NaN 0.81 0.55 0.00 0.10 1.46
1662 1664 Shrek / Shrek 2 2-in-1 Gameboy Advance Video GBA 2007.0 Misc NaN 0.87 0.32 0.00 0.02 1.21
2222 2224 Bentley's Hackpack GBA 2005.0 Misc NaN 0.67 0.25 0.00 0.02 0.93
3159 3161 Nicktoons Collection: Game Boy Advance Video V... GBA 2004.0 Misc NaN 0.46 0.17 0.00 0.01 0.64
3166 3168 SpongeBob SquarePants: Game Boy Advance Video ... GBA 2004.0 Misc NaN 0.46 0.17 0.00 0.01 0.64
3766 3768 SpongeBob SquarePants: Game Boy Advance Video ... GBA 2004.0 Misc NaN 0.38 0.14 0.00 0.01 0.53
4145 4147 Sonic the Hedgehog PS3 NaN Platform NaN 0.00 0.48 0.00 0.00 0.48
4526 4528 The Fairly Odd Parents: Game Boy Advance Video... GBA 2004.0 Misc NaN 0.31 0.11 0.00 0.01 0.43
4635 4637 The Fairly Odd Parents: Game Boy Advance Video... GBA 2004.0 Misc NaN 0.30 0.11 0.00 0.01 0.42
5302 5304 Dragon Ball Z: Budokai Tenkaichi 2 (JP sales) Wii NaN Action NaN 0.15 0.05 0.14 0.01 0.35
5647 5649 Cartoon Network Collection: Game Boy Advance V... GBA 2005.0 Misc NaN 0.23 0.08 0.00 0.01 0.32
6272 6274 The Legend of Zelda: The Minish Cap(weekly JP ... GBA NaN Action NaN 0.00 0.00 0.27 0.01 0.27
6437 6439 Sonic X: Game Boy Advance Video Volume 1 GBA 2004.0 Misc NaN 0.19 0.07 0.00 0.00 0.27
6562 6564 Dora the Explorer: Game Boy Advance Video Volu... GBA 2004.0 Misc NaN 0.18 0.07 0.00 0.00 0.26
6648 6650 Cartoon Network Collection: Game Boy Advance V... GBA 2004.0 Misc NaN 0.18 0.07 0.00 0.00 0.25
6849 6851 All Grown Up!: Game Boy Advance Video Volume 1 GBA 2004.0 Misc NaN 0.17 0.06 0.00 0.00 0.24
7208 7210 Nicktoons Collection: Game Boy Advance Video V... GBA 2004.0 Misc NaN 0.16 0.06 0.00 0.00 0.22
7351 7353 Yu Yu Hakusho: Dark Tournament PS2 NaN Fighting NaN 0.10 0.08 0.00 0.03 0.21
7470 7472 SpongeBob SquarePants: Game Boy Advance Video ... GBA 2004.0 Misc NaN 0.15 0.05 0.00 0.00 0.21
7953 7955 Thomas the Tank Engine & Friends GBA 2004.0 Adventure NaN 0.13 0.05 0.00 0.00 0.19
8330 8332 Dragon Ball GT: Game Boy Advance Video Volume 1 GBA 2004.0 Misc NaN 0.12 0.05 0.00 0.00 0.17
8341 8343 Codename: Kids Next Door: Game Boy Advance Vid... GBA 2004.0 Misc NaN 0.12 0.05 0.00 0.00 0.17
8368 8370 Teenage Mutant Ninja Turtles: Game Boy Advance... GBA 2004.0 Misc NaN 0.12 0.04 0.00 0.00 0.17
8503 8505 Stronghold 3 PC 2011.0 Strategy NaN 0.06 0.10 0.00 0.00 0.16
8770 8772 Cartoon Network Collection: Game Boy Advance V... GBA 2005.0 Misc NaN 0.11 0.04 0.00 0.00 0.15
8848 8850 Pokémon: Johto Photo Finish: Game Boy Advance ... GBA 2004.0 Misc NaN 0.11 0.04 0.00 0.00 0.15
8896 8898 Strawberry Shortcake: Game Boy Advance Video V... GBA 2004.0 Misc NaN 0.11 0.04 0.00 0.00 0.15
9517 9519 Farming Simulator 2011 PC 2010.0 Simulation NaN 0.00 0.13 0.00 0.00 0.13
9749 9751 Super Robot Wars OG Saga: Masou Kishin II - Re... PSP NaN Strategy NaN 0.00 0.00 0.12 0.00 0.12
10382 10384 Disney Channel Collection Vol. 1 GBA 2004.0 Misc NaN 0.08 0.03 0.00 0.00 0.11
10494 10496 Atsumare! Power Pro Kun no DS Koushien DS NaN Sports NaN 0.00 0.00 0.10 0.00 0.10
11076 11078 Action Man-Operation Extreme PS NaN Action NaN 0.05 0.03 0.00 0.01 0.09
11526 11528 Cartoon Network Collection: Game Boy Advance V... GBA 2004.0 Misc NaN 0.06 0.02 0.00 0.00 0.08
12487 12489 Chou Soujuu Mecha MG DS NaN Simulation NaN 0.00 0.00 0.06 0.00 0.06
12517 12519 Prinny: Can I Really Be The Hero? (US sales) PSP NaN Action NaN 0.06 0.00 0.00 0.00 0.06
13278 13280 Monster Hunter Frontier Online PS3 NaN Role-Playing NaN 0.00 0.00 0.05 0.00 0.05
13672 13674 B.L.U.E.: Legend of Water PS NaN Adventure NaN 0.00 0.00 0.04 0.00 0.04
13962 13964 World of Tanks X360 NaN Shooter NaN 0.00 0.03 0.00 0.00 0.04
14087 14089 Housekeeping DS NaN Action NaN 0.00 0.00 0.04 0.00 0.04
14296 14299 Bikkuriman Daijiten DS NaN Misc NaN 0.00 0.00 0.03 0.00 0.03
14311 14314 Silverlicious DS 2012.0 Action NaN 0.03 0.00 0.00 0.00 0.03
14698 14701 UK Truck Simulator PC 2010.0 Simulation NaN 0.00 0.03 0.00 0.00 0.03
14942 14945 Umineko no Naku Koro ni San: Shinjitsu to Gens... PS3 NaN Adventure NaN 0.00 0.00 0.02 0.00 0.02
15056 15059 Xia-Xia DS 2012.0 Platform NaN 0.00 0.02 0.00 0.00 0.02
15261 15264 Mario Tennis 3DS NaN Sports NaN 0.00 0.00 0.02 0.00 0.02
15325 15328 Nicktoons Collection: Game Boy Advance Video V... GBA 2005.0 Misc NaN 0.01 0.01 0.00 0.00 0.02
15353 15356 Demolition Company: Gold Edition PC 2011.0 Simulation NaN 0.00 0.02 0.00 0.00 0.02
15788 15791 Moshi, Kono Sekai ni Kami-sama ga Iru to suru ... PSV 2016.0 Adventure NaN 0.00 0.00 0.02 0.00 0.02
15915 15918 Dream Dancer DS NaN Misc NaN 0.01 0.00 0.00 0.00 0.02
16191 16194 Homeworld Remastered Collection PC NaN Strategy NaN 0.00 0.01 0.00 0.00 0.01
16198 16201 AKB1/48: Idol to Guam de Koishitara... X360 NaN Misc NaN 0.00 0.00 0.01 0.00 0.01
16208 16211 Super Robot Monkey Team: Game Boy Advance Vide... GBA 2005.0 Misc NaN 0.01 0.00 0.00 0.00 0.01
16229 16232 Brothers in Arms: Furious 4 X360 NaN Shooter NaN 0.01 0.00 0.00 0.00 0.01
16367 16370 Dance with Devils PSV 2016.0 Action NaN 0.00 0.00 0.01 0.00 0.01
16494 16497 Legends of Oz: Dorothy's Return 3DS 2014.0 Puzzle NaN 0.00 0.01 0.00 0.00 0.01
16543 16546 Driving Simulator 2011 PC 2011.0 Racing NaN 0.00 0.01 0.00 0.00 0.01
16553 16556 Bound By Flame X360 2014.0 Role-Playing NaN 0.00 0.01 0.00 0.00 0.01
In [7]:
games = Games.dropna()
In [8]:
years_with_nan = games.Year.unique()
nan_array = np.isnan(years_with_nan)
not_nan_array = ~ nan_array
years = years_with_nan[not_nan_array]
years.sort()
years
Out[8]:
array([1980., 1981., 1982., 1983., 1984., 1985., 1986., 1987., 1988.,
       1989., 1990., 1991., 1992., 1993., 1994., 1995., 1996., 1997.,
       1998., 1999., 2000., 2001., 2002., 2003., 2004., 2005., 2006.,
       2007., 2008., 2009., 2010., 2011., 2012., 2013., 2014., 2015.,
       2016., 2017., 2020.])
In [9]:
years_by_numb_of_games_values = games.Year.value_counts().keys().tolist()
years_by_numb_of_games_counts = games.Year.value_counts().tolist()
games.Year.value_counts()
Out[9]:
2009.0    1431
2008.0    1428
2010.0    1257
2007.0    1201
2011.0    1136
2006.0    1008
2005.0     936
2002.0     829
2003.0     775
2004.0     744
2012.0     655
2015.0     614
2014.0     580
2013.0     546
2001.0     482
1998.0     379
2000.0     349
2016.0     342
1999.0     338
1997.0     289
1996.0     263
1995.0     219
1994.0     121
1993.0      60
1981.0      46
1992.0      43
1991.0      41
1982.0      36
1986.0      21
1983.0      17
1989.0      17
1990.0      16
1987.0      16
1988.0      15
1985.0      14
1984.0      14
1980.0       9
2017.0       3
2020.0       1
Name: Year, dtype: int64
In [10]:
games.Publisher
Out[10]:
0          Nintendo
1          Nintendo
2          Nintendo
3          Nintendo
4          Nintendo
            ...    
16593         Kemco
16594    Infogrames
16595    Activision
16596      7G//AMES
16597       Wanadoo
Name: Publisher, Length: 16291, dtype: object
In [11]:
#according to game amount
tops_publisher = games.Publisher.value_counts().head(10)
px.bar(tops_publisher, title= "Top 10 Video Game Publishers According To Game Amount",
      labels={
          "value" : "Number of Games Publishing",
          "index" : "Name of the Publisher"
      })
In [12]:
#according to global game sales
top10_sales_Publisher = []
len(games.Publisher.unique())
Out[12]:
576
In [13]:
#sort according to Global_Sales
publisher_sales = games.loc[:,["Name" ,"Publisher", "NA_Sales", "EU_Sales", "JP_Sales", "Other_Sales",
                               "Global_Sales"]].groupby(by="Publisher").sum()
#reversed_df = df.iloc[::-1]
max_gsales_publisher = publisher_sales.sort_values(["Global_Sales"]).tail(10)
tops_publisher_gsales = max_gsales_publisher.iloc[::-1]
tops_publisher_gsales
Out[13]:
NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
Publisher
Nintendo 815.75 418.30 454.99 95.19 1784.43
Electronic Arts 584.22 367.38 13.98 127.63 1093.39
Activision 426.01 213.72 6.54 74.79 721.41
Sony Computer Entertainment 265.22 187.55 74.10 80.40 607.28
Ubisoft 252.81 163.03 7.33 50.16 473.54
Take-Two Interactive 220.47 117.95 5.83 55.20 399.30
THQ 208.60 94.60 5.01 32.11 340.44
Konami Digital Entertainment 88.91 68.62 90.93 29.91 278.56
Sega 108.78 81.41 56.19 24.30 270.70
Namco Bandai Games 69.38 42.61 126.84 14.64 253.65
In [14]:
px.bar(tops_publisher_gsales["Global_Sales"], title= "Top 10 Video Game Publishers According To Global Game Sales",
      labels={
          "value" : "Number of Games Publishing",
          "index" : "Name of the Publisher"
      })
In [15]:
#according to japan game sales
max_jsales_publisher = publisher_sales.sort_values(["JP_Sales"]).tail(10)
tops_publisher_jsales = max_jsales_publisher.iloc[::-1]
tops_publisher_jsales
Out[15]:
NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
Publisher
Nintendo 815.75 418.30 454.99 95.19 1784.43
Namco Bandai Games 69.38 42.61 126.84 14.64 253.65
Konami Digital Entertainment 88.91 68.62 90.93 29.91 278.56
Sony Computer Entertainment 265.22 187.55 74.10 80.40 607.28
Capcom 78.45 39.16 67.38 14.82 199.95
Sega 108.78 81.41 56.19 24.30 270.70
Square Enix 48.59 32.57 49.79 13.84 144.73
SquareSoft 11.06 4.95 40.13 1.54 57.65
Enix Corporation 0.76 0.31 32.40 0.27 33.74
Tecmo Koei 14.08 7.08 29.21 3.18 53.55
In [16]:
px.bar(tops_publisher_jsales["JP_Sales"], title= "Top 10 Video Game Publishers According To Game Sales in Japan",
      labels={
          "value" : "Number of Games Publishing",
          "index" : "Name of the Publisher"
      })
In [17]:
#according to europe game sales
max_esales_publisher = publisher_sales.sort_values(["EU_Sales"]).tail(10)
tops_publisher_esales = max_esales_publisher.iloc[::-1]
tops_publisher_esales
Out[17]:
NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
Publisher
Nintendo 815.75 418.30 454.99 95.19 1784.43
Electronic Arts 584.22 367.38 13.98 127.63 1093.39
Activision 426.01 213.72 6.54 74.79 721.41
Sony Computer Entertainment 265.22 187.55 74.10 80.40 607.28
Ubisoft 252.81 163.03 7.33 50.16 473.54
Take-Two Interactive 220.47 117.95 5.83 55.20 399.30
THQ 208.60 94.60 5.01 32.11 340.44
Sega 108.78 81.41 56.19 24.30 270.70
Konami Digital Entertainment 88.91 68.62 90.93 29.91 278.56
Microsoft Game Studios 155.35 68.61 3.26 18.56 245.79
In [18]:
px.bar(tops_publisher_esales["EU_Sales"], title= "Top 10 Video Game Publishers According To Game Sales in Europe",
      labels={
          "value" : "Number of Games Publishing",
          "index" : "Name of the Publisher"
      })
In [19]:
#according to north america game sales
max_nsales_publisher = publisher_sales.sort_values(["NA_Sales"]).tail(10)
tops_publisher_nsales = max_nsales_publisher.iloc[::-1]
tops_publisher_nsales
Out[19]:
NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
Publisher
Nintendo 815.75 418.30 454.99 95.19 1784.43
Electronic Arts 584.22 367.38 13.98 127.63 1093.39
Activision 426.01 213.72 6.54 74.79 721.41
Sony Computer Entertainment 265.22 187.55 74.10 80.40 607.28
Ubisoft 252.81 163.03 7.33 50.16 473.54
Take-Two Interactive 220.47 117.95 5.83 55.20 399.30
THQ 208.60 94.60 5.01 32.11 340.44
Microsoft Game Studios 155.35 68.61 3.26 18.56 245.79
Sega 108.78 81.41 56.19 24.30 270.70
Atari 101.23 25.80 10.70 8.73 146.77
In [20]:
px.bar(tops_publisher_nsales["NA_Sales"], title= "Top 10 Video Game Publishers According To Game Sales in North America",
      labels={
          "value" : "Number of Games Publishing",
          "index" : "Name of the Publisher"
      })
In [21]:
#according to north america game sales
max_osales_publisher = publisher_sales.sort_values(["Other_Sales"]).tail(10)
tops_publisher_osales = max_osales_publisher.iloc[::-1]
tops_publisher_osales
Out[21]:
NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
Publisher
Electronic Arts 584.22 367.38 13.98 127.63 1093.39
Nintendo 815.75 418.30 454.99 95.19 1784.43
Sony Computer Entertainment 265.22 187.55 74.10 80.40 607.28
Activision 426.01 213.72 6.54 74.79 721.41
Take-Two Interactive 220.47 117.95 5.83 55.20 399.30
Ubisoft 252.81 163.03 7.33 50.16 473.54
THQ 208.60 94.60 5.01 32.11 340.44
Konami Digital Entertainment 88.91 68.62 90.93 29.91 278.56
Sega 108.78 81.41 56.19 24.30 270.70
Microsoft Game Studios 155.35 68.61 3.26 18.56 245.79
In [22]:
px.bar(tops_publisher_osales["Other_Sales"], title= "Top 10 Video Game Publishers According To Game Sales in Other Regions",
      labels={
          "value" : "Number of Games Publishing",
          "index" : "Name of the Publisher"
      })
In [23]:
#global sales according to years
figs = []
game_sales_inyears = games.groupby(['Year','Publisher'], as_index=False)['Global_Sales'].sum()
top_gallsales_inyears = pd.DataFrame()

for i in range(len(years)):
    if i == 0:
        top_gallsales_inyears = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "Global_Sales",
                                                                                                   ascending = False).head(2)
        
    else:
        df = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "Global_Sales",
                                                                                    ascending = False).head(2)
        top_gallsales_inyears = top_gallsales_inyears.append(df, ignore_index=True)

top_gallsales_inyears
Out[23]:
Year Publisher Global_Sales
0 1980.0 Atari 8.36
1 1980.0 Activision 3.02
2 1981.0 Activision 8.50
3 1981.0 Atari 8.45
4 1982.0 Atari 19.43
... ... ... ...
72 2016.0 Electronic Arts 12.25
73 2016.0 Ubisoft 9.76
74 2017.0 Sega 0.04
75 2017.0 Idea Factory 0.01
76 2020.0 Ubisoft 0.29

77 rows × 3 columns

In [24]:
publishers = top_gallsales_inyears.Publisher.unique()
for p in range(len(publishers)):
    figs.append(go.Scatter(x = years, y=top_gallsales_inyears.Global_Sales[top_gallsales_inyears.Publisher == publishers[p]],
                           name=publishers[p], line_shape="vh"))
     
    
layout = dict(title="Year Wise Global Game Sales According to Years",
             xaxis = dict(title = "Years"), yaxis=dict(title = "Total Sales In Millions"))
figure=dict(data=figs, layout=layout)
iplot(figure)
In [25]:
fig = px.scatter(top_gallsales_inyears, x="Global_Sales", y="Year", color="Publisher", size="Global_Sales",
                hover_data=["Publisher"], title="All Year Wise Global Game Sales In Millions According to Years",
                labels={"x": "Global_Sales", "y": "Year"})
fig.show()
In [26]:
figs = []
for i in range(20,31):
    if i == 20:
        top_gsales_inyears = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "Global_Sales",
                                                                                                   ascending = False).head(5)
        
    else:
        df = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "Global_Sales",
                                                                                    ascending = False).head(5)
        top_gsales_inyears = top_gsales_inyears.append(df, ignore_index=True)

publishers = top_gsales_inyears.Publisher.unique()
for p in range(len(publishers)):
    figs.append(go.Scatter(x = years[20:31], y=top_gsales_inyears.Global_Sales[top_gsales_inyears.Publisher == publishers[p]],
                           name=publishers[p], line_shape="vh"))
     
        
layout = dict(title="Year Wise Global Game Sales According to Years",
             xaxis = dict(title = "Years"), yaxis=dict(title = "Total Sales In Millions"))
figure=dict(data=figs, layout=layout)
iplot(figure)
In [27]:
fig = px.scatter(top_gsales_inyears, x="Global_Sales", y="Year", color="Publisher", size="Global_Sales",
                hover_data=["Publisher"], title="Year Wise Global Game Sales In Millions According to Years",
                labels={"x": "Global_Sales", "y": "Year"})
fig.show()
In [28]:
game09 = games[games.Year == 2009]
global_val = top_gsales_inyears.Publisher[top_gsales_inyears.Year == 2009]
values = pd.DataFrame()
result = pd.DataFrame()
for i in range(len(global_val)):
    if i == 0:
        values = game09[game09.Publisher == global_val.iloc[i]]
        result = values[values.Global_Sales == values.Global_Sales.max()]
    else:
        values = game09[game09.Publisher == global_val.iloc[i]]
        result = result.append(values[values.Global_Sales == values.Global_Sales.max()])

fig = px.sunburst(result, path = ["Name", "Genre", "Publisher"], values = result["Global_Sales"],
                      title="Best Selling Games of the Top 5 Distributors in Global in 2011 and Their Genres")
fig.update_layout(
grid=dict(columns=2, rows=2),
margin=dict(t=40, l=2, r=2, b=5))
fig.show()
In [29]:
figs = []
game_sales_inyears = games.groupby(['Year','Publisher'], as_index=False)['JP_Sales'].sum()
top_jsales_inyears = pd.DataFrame()
for i in range(20,31):
    if i == 20:
        top_jsales_inyears = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "JP_Sales",
                                                                                                   ascending = False).head(5)
        
    else:
        df = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "JP_Sales",
                                                                                    ascending = False).head(5)
        top_jsales_inyears = top_jsales_inyears.append(df, ignore_index=True)

publishers = top_jsales_inyears.Publisher.unique()
for p in range(len(publishers)):
    figs.append(go.Scatter(x = years[20:31], y=top_jsales_inyears.JP_Sales[top_jsales_inyears.Publisher == publishers[p]],
                           name=publishers[p], line_shape="vh"))
     
        
layout = dict(title="Year Wise Game Sales in Japan According to Years",
             xaxis = dict(title = "Years"), yaxis=dict(title = "Total Sales In Millions"))
figure=dict(data=figs, layout=layout)
iplot(figure)
In [30]:
fig = px.scatter(top_jsales_inyears, x="JP_Sales", y="Year", color="Publisher", size="JP_Sales",
                hover_data=["Publisher"], title="Year Wise Game Sales In Japan In Millions According to Years",
                labels={"x": "JP_Sales", "y": "Year"})
fig.show()
In [31]:
game09 = games[games.Year == 2009]
japan_val = top_jsales_inyears.Publisher[top_jsales_inyears.Year == 2009]
values = pd.DataFrame()
result = pd.DataFrame()
for i in range(len(japan_val)):
    if i == 0:
        values = game09[game09.Publisher == japan_val.iloc[i]]
        result = values[values.JP_Sales == values.JP_Sales.max()]
    else:
        values = game09[game09.Publisher == japan_val.iloc[i]]
        result = result.append(values[values.JP_Sales == values.JP_Sales.max()])

fig = px.sunburst(result, path = ["Name", "Genre", "Publisher"], values = result["JP_Sales"],
                      title="Best Selling Games of the Top 5 Distributors in Japan in 2011 and Their Genres")
fig.update_layout(
grid=dict(columns=2, rows=2),
margin=dict(t=40, l=2, r=2, b=5))
fig.show()
In [32]:
figs = []
game_sales_inyears = games.groupby(['Year','Publisher'], as_index=False)['EU_Sales'].sum()
top_eusales_inyears = pd.DataFrame()
for i in range(20,31):
    if i == 20:
        top_eusales_inyears = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "EU_Sales",
                                                                                                   ascending = False).head(5)
        
    else:
        df = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "EU_Sales",
                                                                                    ascending = False).head(5)
        top_eusales_inyears = top_eusales_inyears.append(df, ignore_index=True)

publishers = top_eusales_inyears.Publisher.unique()
for p in range(len(publishers)):
    figs.append(go.Scatter(x = years[20:31], y=top_eusales_inyears.EU_Sales[top_eusales_inyears.Publisher == publishers[p]],
                           name=publishers[p], line_shape="vh"))
     
        
layout = dict(title="Year Wise Game Sales in Europe According to Years",
             xaxis = dict(title = "Years"), yaxis=dict(title = "Total Sales In Millions"))
figure=dict(data=figs, layout=layout)
iplot(figure)
In [33]:
fig = px.scatter(top_eusales_inyears, x="EU_Sales", y="Year", color="Publisher", size="EU_Sales",
                hover_data=["Publisher"], title="Year Wise Game Sales In Europe In Millions According to Years",
                labels={"x": "EU_Sales", "y": "Year"})
fig.show()
In [34]:
game09 = games[games.Year == 2009]
eu_val = top_eusales_inyears.Publisher[top_eusales_inyears.Year == 2009]
values = pd.DataFrame()
result = pd.DataFrame()
for i in range(len(eu_val)):
    if i == 0:
        values = game09[game09.Publisher == eu_val.iloc[i]]
        result = values[values.EU_Sales == values.EU_Sales.max()]
    else:
        values = game09[game09.Publisher == eu_val.iloc[i]]
        result = result.append(values[values.EU_Sales == values.EU_Sales.max()])

fig = px.sunburst(result, path = ["Name", "Genre", "Publisher"], values = result["EU_Sales"],
                      title="Best Selling Games of the Top 5 Distributors in Europe in 2011 and Their Genres")
fig.update_layout(
grid=dict(columns=2, rows=2),
margin=dict(t=40, l=2, r=2, b=5))
fig.show()
In [35]:
figs = []
game_sales_inyears = games.groupby(['Year','Publisher'], as_index=False)['NA_Sales'].sum()
top_nasales_inyears = pd.DataFrame()
for i in range(20,31):
    if i == 20:
        top_nasales_inyears = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "NA_Sales",
                                                                                                   ascending = False).head(5)
        
    else:
        df = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "NA_Sales",
                                                                                    ascending = False).head(5)
        top_nasales_inyears = top_nasales_inyears.append(df, ignore_index=True)

publishers = top_nasales_inyears.Publisher.unique()
for p in range(len(publishers)):
    figs.append(go.Scatter(x = years[20:31], y=top_nasales_inyears.NA_Sales[top_nasales_inyears.Publisher == publishers[p]],
                           name=publishers[p], line_shape="vh"))
     
        
layout = dict(title="Year Wise Game Sales in North America According to Years",
             xaxis = dict(title = "Years"), yaxis=dict(title = "Total Sales In Millions"))
figure=dict(data=figs, layout=layout)
iplot(figure)
In [36]:
fig = px.scatter(top_nasales_inyears, x="NA_Sales", y="Year", color="Publisher", size="NA_Sales",
                hover_data=["Publisher"], title="Year Wise Game Sales In North America In Millions According to Years",
                labels={"x": "NA_Sales", "y": "Year"})
fig.show()
In [37]:
game09 = games[games.Year == 2009]
na_val = top_nasales_inyears.Publisher[top_nasales_inyears.Year == 2009]
values = pd.DataFrame()
result = pd.DataFrame()
for i in range(len(na_val)):
    if i == 0:
        values = game09[game09.Publisher == eu_val.iloc[i]]
        result = values[values.NA_Sales == values.NA_Sales.max()]
    else:
        values = game09[game09.Publisher == eu_val.iloc[i]]
        result = result.append(values[values.NA_Sales == values.NA_Sales.max()])

fig = px.sunburst(result, path = ["Name", "Genre", "Publisher"], values = result["NA_Sales"],
                      title="Best Selling Games of the Top 5 Distributors in North America in 2011 and Their Genres")
fig.update_layout(
grid=dict(columns=2, rows=2),
margin=dict(t=40, l=2, r=2, b=5))
fig.show()
In [38]:
figs = []
game_sales_inyears = games.loc[:,["Year", "Publisher", "Other_Sales"]].groupby(['Year','Publisher'], as_index=False)['Other_Sales'].sum()
top_osales_inyears = pd.DataFrame()
for i in range(20,31):
    if i == 20:
        top_osales_inyears = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "Other_Sales",
                                                                                                   ascending = False).head(5)
        
    else:
        df = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "Other_Sales",
                                                                                    ascending = False).head(5)
        top_osales_inyears = top_osales_inyears.append(df, ignore_index=True)

publishers = top_osales_inyears.Publisher.unique()
for p in range(len(publishers)):
    figs.append(go.Scatter(x = years[20:31], y=top_osales_inyears.Other_Sales[top_osales_inyears.Publisher == publishers[p]],
                           name=publishers[p], line_shape="vh"))
     
        
layout = dict(title="Year Wise Game Sales in Other Regions According to Years",
             xaxis = dict(title = "Years"), yaxis=dict(title = "Total Sales In Millions"))
figure=dict(data=figs, layout=layout)
iplot(figure)
In [39]:
fig = px.scatter(top_osales_inyears, x="Other_Sales", y="Year", color="Publisher", size="Other_Sales",
                hover_data=["Publisher"], title="Year Wise Game Sales In Other Regions In Millions According to Years",
                labels={"x": "Other_Sales", "y": "Year"})
fig.show()
In [40]:
"""
years_by_numb_of_games_values
years_by_numb_of_games_counts
top_osales_inyears[top_osales_inyears["Year"] == 2011]
"""
game09 = games[games.Year == 2009]
other_val = top_osales_inyears.Publisher[top_osales_inyears.Year == 2009]
values = pd.DataFrame()
result = pd.DataFrame()
for i in range(len(other_val)):
    if i == 0:
        values = game09[game09.Publisher == other_val.iloc[i]]
        result = values[values.Other_Sales == values.Other_Sales.max()]
    else:
        values = game09[game09.Publisher == other_val.iloc[i]]
        result = result.append(values[values.Other_Sales == values.Other_Sales.max()])


fig = px.sunburst(result, path = ["Name", "Genre", "Publisher"], values = result["Other_Sales"],
                      title="Best Selling Games of the Top 5 Distributors in Other Regions in 2011 and Their Genres")
fig.update_layout(
grid=dict(columns=2, rows=2),
margin=dict(t=40, l=2, r=2, b=5))
fig.show()
In [41]:
#global sales according to years - zoom toplantısında yapılan kısım
#group by genre and year
figs = []
game_sales_inyears = games.groupby(['Year','Genre'], as_index=False)['Global_Sales'].sum()
top_genre_sales_inyears = pd.DataFrame()

for i in range(len(years)):
    if i == 0:
        top_genre_sales_inyears = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "Global_Sales",
                                                                                                   ascending = False).head(5)
        
    else:
        df = game_sales_inyears[game_sales_inyears["Year"] == years[i]].sort_values(by = "Global_Sales",
                                                                                    ascending = False).head(5)
        top_genre_sales_inyears = top_genre_sales_inyears.append(df, ignore_index=True)

top_genre_sales_inyears
Out[41]:
Year Genre Global_Sales
0 1980.0 Shooter 7.07
1 1980.0 Misc 2.71
2 1980.0 Fighting 0.77
3 1980.0 Sports 0.49
4 1980.0 Action 0.34
... ... ... ...
183 2016.0 Role-Playing 6.76
184 2016.0 Fighting 3.86
185 2017.0 Role-Playing 0.04
186 2017.0 Action 0.01
187 2020.0 Simulation 0.29

188 rows × 3 columns

In [42]:
publishers = top_genre_sales_inyears.Genre.unique()
for p in range(len(publishers)):
    figs.append(go.Scatter(x = years, y=top_genre_sales_inyears.Global_Sales[top_genre_sales_inyears.Genre == publishers[p]],
                           name=publishers[p], line_shape="vh"))
     
    
layout = dict(title="Year Wise Global Game Sales According to Years",
             xaxis = dict(title = "Years"), yaxis=dict(title = "Total Sales In Millions"))
figure=dict(data=figs, layout=layout)
iplot(figure)
In [43]:
#df[df['Country (region)'].str.match('^P.*')== True]

GTA = games[games["Name"].str.match("Grand Theft Auto") == True]
#GTA.Name.unique()
GTA
Out[43]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
16 17 Grand Theft Auto V PS3 2013.0 Action Take-Two Interactive 7.01 9.27 0.97 4.14 21.40
17 18 Grand Theft Auto: San Andreas PS2 2004.0 Action Take-Two Interactive 9.43 0.40 0.41 10.57 20.81
23 24 Grand Theft Auto V X360 2013.0 Action Take-Two Interactive 9.63 5.31 0.06 1.38 16.38
24 25 Grand Theft Auto: Vice City PS2 2002.0 Action Take-Two Interactive 8.41 5.49 0.47 1.78 16.15
38 39 Grand Theft Auto III PS2 2001.0 Action Take-Two Interactive 6.99 4.51 0.30 1.30 13.10
44 45 Grand Theft Auto V PS4 2014.0 Action Take-Two Interactive 3.80 5.81 0.36 2.02 11.98
51 52 Grand Theft Auto IV X360 2008.0 Action Take-Two Interactive 6.76 3.10 0.14 1.03 11.02
56 57 Grand Theft Auto IV PS3 2008.0 Action Take-Two Interactive 4.76 3.76 0.44 1.62 10.57
90 91 Grand Theft Auto: Liberty City Stories PSP 2005.0 Action Take-Two Interactive 2.90 2.83 0.24 1.75 7.72
197 198 Grand Theft Auto V XOne 2014.0 Action Take-Two Interactive 2.66 2.01 0.00 0.41 5.08
198 199 Grand Theft Auto: Vice City Stories PSP 2006.0 Action Take-Two Interactive 1.70 2.02 0.16 1.21 5.08
360 361 Grand Theft Auto: Liberty City Stories PS2 2006.0 Action Take-Two Interactive 1.56 1.40 0.07 0.50 3.54
388 389 Grand Theft Auto 2 PS 1998.0 Action Take-Two Interactive 1.13 2.07 0.00 0.22 3.42
684 686 Grand Theft Auto PS 1997.0 Action Take-Two Interactive 0.79 1.35 0.04 0.14 2.32
873 875 Grand Theft Auto: San Andreas XB 2005.0 Action Take-Two Interactive 1.26 0.61 0.00 0.09 1.95
1441 1443 Grand Theft Auto: Chinatown Wars DS 2009.0 Action Take-Two Interactive 0.59 0.57 0.05 0.14 1.35
1896 1898 Grand Theft Auto V PC 2015.0 Action Take-Two Interactive 0.36 0.64 0.00 0.08 1.08
1902 1904 Grand Theft Auto: Chinatown Wars PSP 2009.0 Action Take-Two Interactive 0.28 0.50 0.03 0.28 1.08
2120 2122 Grand Theft Auto: San Andreas PC 2005.0 Action Take-Two Interactive 0.00 0.92 0.00 0.05 0.98
2138 2140 Grand Theft Auto: Vice City Stories PS2 2007.0 Action Take-Two Interactive 0.78 0.03 0.03 0.13 0.97
2357 2359 Grand Theft Auto IV PC 2008.0 Action Take-Two Interactive 0.01 0.79 0.00 0.08 0.88
6905 6907 Grand Theft Auto GBA 2004.0 Action Take-Two Interactive 0.17 0.06 0.00 0.00 0.24
9827 9829 Grand Theft Auto: San Andreas X360 2008.0 Action Take-Two Interactive 0.08 0.03 0.00 0.01 0.12
10379 10381 Grand Theft Auto: Mission Pack #1, London 1969 PS 1998.0 Adventure Take-Two Interactive 0.06 0.04 0.00 0.01 0.11
13732 13734 Grand Theft Auto: Vice City PC 2003.0 Action Take-Two Interactive 0.00 0.03 0.00 0.01 0.04
16093 16096 Grand Theft Auto III PC 2002.0 Action Take-Two Interactive 0.00 0.01 0.00 0.00 0.01
In [44]:
FIFA = games[games["Name"].str.match("FIFA") == True]
#FIFA.Name.unique()
FIFA
Out[44]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
77 78 FIFA 16 PS4 2015.0 Sports Electronic Arts 1.11 6.06 0.06 1.26 8.49
82 83 FIFA Soccer 13 PS3 2012.0 Action Electronic Arts 1.06 5.05 0.13 2.01 8.24
112 113 FIFA 14 PS3 2013.0 Sports Electronic Arts 0.78 4.32 0.07 1.73 6.90
121 122 FIFA 12 PS3 2011.0 Sports Electronic Arts 0.84 4.32 0.11 1.42 6.69
124 125 FIFA 15 PS4 2014.0 Sports Electronic Arts 0.79 4.29 0.05 1.47 6.59
... ... ... ... ... ... ... ... ... ... ... ...
13611 13613 FIFA Soccer 2003 (weekly jp sales) PS2 2002.0 Sports Electronic Arts 0.00 0.00 0.04 0.00 0.04
13851 13853 FIFA World Cup Germany 2006 DS 2006.0 Sports Electronic Arts 0.03 0.00 0.00 0.00 0.04
14251 14254 FIFA World Cup: Germany 2006 GBA 2006.0 Sports Electronic Arts 0.02 0.01 0.00 0.00 0.03
15205 15208 FIFA Soccer 09 PC 2008.0 Sports Electronic Arts 0.00 0.02 0.00 0.00 0.02
15837 15840 FIFA Soccer 08 PC 2007.0 Sports Electronic Arts 0.00 0.01 0.00 0.00 0.02

131 rows × 11 columns

In [ ]: